function validateForm(){
    var userType = document.getElementById("userType");
    var firstName = document.getElementById("firsName");
    var lastName = document.getElementById("lastName");
    var email = document.getElementById("email");
    var addres = document.getElementById("address");
    var emailExpression = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
    var numericExpression = /^[0-9]+$/;
    var alphaExpression = /^[a-zA-Z]+$/;
    var alphaNumericExpression = /^[0-9a-zA-Z]+$/;
    
    if(userTypeSelection(userType,"Please select User Type")){
    
        if(notEmpty(firstName,"First Name cannot be empty")){
        
            if(isAlphabet(firstName,"Please enter only letters for First Name")){
        
                if(notEmpty(lastName,"Last Name cannot be empty")){
        
                    if(isAlphabet(lastName,"Please enter only letters for Last Name")){
         
                        if(notEmpty(email,"Email field cannot be empty")){
                            if(emailValidator(email,"Please enter a valid email address")){
            
                                if(isAlpaNumericExpression(addres,"Please fill in Address")){
                       
                                    return true;
                                }
                            }
                        }
                    }
                }
            }
        }
        return false;
    


        function notEmpty(element,errorMessage){
            if(element.value.length == 0 || element == ""){
                alert(errorMessage);
                element.focus();
                return false;
            }
            return true;
        }
    

        function isAlphabet(alphabet,errorMessage){
            if(alphabet.value.match(alphaExpression)){
                return true;
            }
            else {
                alert(errorMessage);
                number.focus();
                return false;
            }
        }
        function userTypeSelection(userType,errorMessage){
            if(userType.value == ""){
                alert(errorMessage);
                userType.focus();
                return false;
            }
            else{
                return true;
            }
        }
        function emailValidator(email,errorMessage){
            if(email.value.match(emailExpression)){
                return true;
            }
            else{
                alert(errorMessage);
                email.focus();
                return false;
            }
        
        }
        function isAlphaNum(alpNum,errorMessage){
            if(alpNum.value.match(alphaNumericExpression)){
                return true;
            }
            else{
                alert(errorMessage);
                alpNum.focus();
                return false;
            }
            
        }
        
    }

}